package com.qiangesoft.bootcodegen.constant;

/**
 * 数据库类型枚举
 *
 * @author qiangesoft
 * @date 2024-03-15
 */
public enum DbType {

    MySQL("com.mysql.cj.jdbc.Driver"),

    Oracle("oracle.jdbc.OracleDriver"),

    SQLServer("com.microsoft.sqlserver.jdbc.SQLServerDriver"),

    PostgreSQL("org.postgresql.Driver"),

    DM("dm.jdbc.driver.DmDriver");

    private final String driverClass;

    DbType(String driverClass) {
        this.driverClass = driverClass;
    }

    public String getDriverClass() {
        return this.driverClass;
    }

    public static String getDriverClassByName(String name) {
        for (DbType value : values()) {
            if (value.name().equals(name)) {
                return value.getDriverClass();
            }
        }
        return null;
    }

}